import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/view/home'
import Main from '@/view/Main'
import Login from '@/view/login'
import UserMng from '@/view/system/UserMng'
import RoleMng from '@/view/system/RoleMng'
Vue.use(Router)

let routes = [{
  path: '/login',
  component: Login,
  hidden: true
}, {
  path: '/',
  component: Main,
  hidden: true,
  children: [{
    path: '/',
    component: Home,
    name: '首页'
  }]
}]

const SystemRouter = [{
  path: '/system',
  name: '系统管理',
  component: Main,
  iconCls: 'fa fa-cog',
  children: [{
    path: '/system/contract',
    component: UserMng,
    name: '用户管理'
  }, {
    path: '/system/RoleMng',
    component: RoleMng,
    name: '角色管理'
  }]
}]

for (let i in SystemRouter) {
  routes.push(SystemRouter[i])
}

const router = new Router({
  routes: routes
})

export default router
